#include "protocol.h"

class UDP
{
public:
	UDP(const int port);
	~UDP();

public:
	int init(const int port);

public:
	virtual int dealPackage(const unsigned char *package, const int packageSize, const struct sockaddr_in *rNetAddr) = 0;
	void recvPackage();
	struct sockaddr_in remoteNetAddr;
	int listenPort;
	int listenSock;
	bool isRunning;
	unsigned char udpSendPackageData[MAX_UDP_PACKAGE_SIZE];

private:
	int startListen(const int port);
};